#pragma once
#include <ace/Asynch_Acceptor.h>
#include <ace/Recursive_Thread_Mutex.h>
//#include <ace/Null_Mutex.h>

#include "Channel.h"


class AsyncAcceptor : public ACE_Asynch_Acceptor<Channel>
{
public:
	AsyncAcceptor(void);
	virtual ~AsyncAcceptor(void);

protected:
	/// This is called when an outstanding accept completes.
	virtual void handle_accept (const ACE_Asynch_Accept::Result &result);

	/**
	* This is the template method used to create new handler.
	* Subclasses must overwrite this method if a new handler creation
	* strategy is required.
	*/
	virtual Channel * make_handler (void);


private:
	Channel* m_accepted;
	ACE_Recursive_Thread_Mutex m_acceptLock;
};
